package com.iretailer.web;

import com.iretailer.util.ResponeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
public class IndexController {
    private Logger log = LoggerFactory.getLogger(IndexController.class);

    @RequestMapping("/")
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws IOException {
//            response.sendRedirect("/index.html");
//        request.getRequestDispatcher("/index.html");
        return new ModelAndView("index");
    }

    @RequestMapping("/unauth.action")
    public void unauth(HttpServletResponse response) {
        log.error("========= /unauth.action");
        ResponeUtil.sendSuccess(response, "401", "code");
    }
}
